<h1>Listing assignments</h1>

<table>
  <tr>
  <% for column in Assignment.content_columns %>
    <th><%= column.human_name %></th>
  <% end %>
  </tr>
  
<% for assignment in @assignments %>
  <tr>
	<td><%= assignment.date %></td>
	<td><%= assignment.full_name %></td>
  <% for column in Assignment.content_columns %>
    <td><%=h assignment.send(column.name) %></td>
  <% end %>
    <td><%= link_to 'Show', :action => 'show', :id => assignment %></td>
    <td><%= link_to 'Edit', :action => 'edit', :id => assignment %></td>
    <td><%= link_to 'Destroy', { :action => 'destroy', :id => assignment }, :confirm => 'Are you sure?', :method => :post %></td>
  </tr>
<% end %>
</table>

<%= link_to 'Previous page', { :page => @assignment_pages.current.previous } if @assignment_pages.current.previous %>
<%= link_to 'Next page', { :page => @assignment_pages.current.next } if @assignment_pages.current.next %> 

<br />

<%= link_to 'New assignment', :action => 'new' %>
